-
-
Notifications
You must be signed in to change notification settings - Fork 157
EMIN AKTURK | BIRMINGHAM | MODULE-DATA-GROUPS - SPRINT 1 #754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work on this sprint - I think most of the answers are good, but I do have a question about the dedupe task
Sprint-1/implement/dedupe.js
Outdated
} | ||
|
||
const seen = new Set(); | ||
return elements.filter(element => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While using a filter here does work, I feel like it is perhaps not the most logical way to approach this task.
Filters are typically used to transform one array into another, here you are using it to make changes to a set. Can you think of a way to rewrite this that might make it more readable / clear what the code is intended to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your review. I have added codes that could be more logical and easier to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an improvement to the duplicate and its easier to read. But here you are now adding to a second array as well as the set. As you are using a set, can you think of a way to use just those values in the set and not need to duplicate the values in an array as well?
That was a great point, I adjusted the code as you wish. I hope that would be enough 👍 |
Good work - you are done with this sprint now, well done |
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.